﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartCity.ProcessEngine.Api.Read.Application.Command.Node;
using SmartCity.ProcessEngine.Api.Read.Dtos;
using SmartCity.ProcessEngine.ErrorCode;

namespace SmartCity.ProcessEngine.Api.Read.Controllers
{
    /// <summary>
    /// 节点控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class NodeController : ControllerBase
    {
        private readonly IMediator mediator;

        public NodeController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 分页获取节点列表
        /// </summary>
        /// <param name="request">请求条件</param>
        /// <returns>节点列表</returns>
        [HttpGet]
        public   Task<ApiPaging<NodeDTO>> GetNodes([FromQuery]GetNodeCommand request) { 
        return mediator.Send(request);
        }
    }
}
